<template>
  <div>
    商品详情
    <p>名称：{{ goodsDetail.goodsName }}</p>
    <p>价格：{{ goodsDetail.price }}</p>
    <p>销量：{{ goodsDetail.sales }}</p>
    <p>库存：{{ goodsDetail.stock }}</p>
  </div>
</template>

<script setup>
import { reactive } from 'vue';

// import { useRoute } from 'vue-router';
// const route = useRoute();
// console.log(route.params.id)

const props = defineProps(["id"]);
console.log(props.id);

let goodsDetail = reactive({});

fetch("/api/goods?id="+props.id)
.then(res=>res.json())
.then(res=>{
  goodsDetail.goodsName = res.data[0].goodsName;
})
</script>